/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.tnmk.worktime.service.dao.entry;

import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;

/**
 *
 * @author tnmkhoi
 */
@XmlAccessorType(XmlAccessType.FIELD)
public abstract class BaseEntry implements Serializable{
  protected Integer id = null;

  /**
   * @return the id
   */
  public Integer getId() {
    return id;
  }

  /**
   * @param id the id to set
   */
  public void setId(Integer id) {
    this.id = id;
  }
  
  @Override
  public boolean equals(Object o){
    if (o == null || !(o instanceof BaseEntry)) {
      return false;
    }
    BaseEntry e = (BaseEntry)o;
    if (this.id == null || e.getId() == null) {
      return false;
    }
    return this.id.equals(e.getId());
  }
  
  @Override
  public int hashCode(){
    if (id == null) {
      return super.hashCode();
    }
    return this.id.hashCode();
  }
}
